package guo.controller;

import guo.config.SingleBeanT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

@Controller
@ResponseBody
public class SingelBeanC {

    @GetMapping("/test")
    public String testSingleBean(){

        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        String[] names = context.getBeanDefinitionNames();
        for (String s:names){
            System.out.println("s = " + s);
        }

//        new Thread(()->{
//            System.out.println(bean.method1("33"));
//        }).start();
//        new Thread(()->{
//            System.out.println(bean.method1("44"));
//        }).start();
        return "11";
    }
}
